#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
char s[1000100];
int nt[1000100];
int len;
void getnt()
{
	nt[0]=-1;
	int i = 0;
	int t = -1;
	while(i<len)
	{
		if(t==-1||s[i]==s[t])
		{
			i++;
			t++;
			nt[i] = t;
		}
		else t = nt[t];
	}
}
int main()
{
	while(scanf("%s",s)!=EOF)
	{
		int ans;
		if(strcmp(s,".")==0) return 0;
		len = strlen(s);
		getnt();
		int l = len - nt[len];
		if(len%l==0) ans = len/l;
		else ans = 1;
		printf("%d\n",ans);
		
	}
}
